package examples.contacts.util

import java.time.Clock
import java.time.ZoneId
import java.time.ZonedDateTime

/**
 * Created by Misty on 2015/6/6.
 */
class CentralClock {
    private static Clock clock = Clock.systemDefaultZone()

    static Clock getClock() {
        return clock
    }

    static Clock setClock(Clock clock) {
        CentralClock.clock = clock
    }

    static void setFixedClock(ZonedDateTime zonedDateTime) {
        clock = Clock.fixed(zonedDateTime.toInstant(), ZoneId.systemDefault())
    }
}
